#ifndef _SRC_VIDEO_TEXTURE_HPP
#define _SRC_VIDEO_TEXTURE_HPP

#include "../common.hpp"
#include "image.hpp"

namespace yep
{
class Surface; // foward declaration
/**
 * @brief A non-modifiable image which is used as source on
 *  to draw.
 *
 * It will, in future use SDL_Texture. Today is only a surface that
 *   always is on display format.
 **/
class Texture: public Image
{
public:
    /**
     * @brief Creates texture copying from a surface.
     *
     * @param surface the SDL_Texture to use.
     **/
    Texture( SDL_Surface *surface );

    /**
     * @brief load from the rw.
     **/
    Texture( SDL_RWops *loadFrom, bool freesrc );

    /**
     * @brief Load from a file.
     **/
    Texture( const string &file );

    /**
     * @brief Creates a new Texture based on a Surface;
     **/
    Texture( const Surface &surface );

    /**
     * @brief Copy Constructor
     **/
    Texture( const Texture &texture );

    /**
     * @brief Destructor
     **/
    ~Texture();

    /**
     * @brief Returns the width
     **/
    unsigned getWidth() const
    {
        return surface->w;
    }

    /**
     * @brief Returns the height
     **/
    unsigned getHeight() const
    {
        return surface->h;
    }


    /**
     * @see Drawable::draw()
     **/
    void draw( Canvas &canvas, const Vector2 &position );

    /**
     * @see Drawable::draw(Canvas,Vector2,Vector2,Vector2)
     **/
    void draw( Canvas &canvas, const Vector2 &position, const Vector2 &sectionPosition, const Vector2 &sectionSize );
private:
    SDL_Surface *surface;
};

}

#endif // _SRC_VIDEO_TEXTURE_HPP

